home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
8bit
/
cislib_b
/
superk.act
< prev
next >
Wrap
Text File
|
1995-04-22
|
3KB
|
110 lines
;SUPERK.ACT
;Bill Aycock 73067,220
;Get exten for pfkey file from cmd line
;then have SuperKEY! load desired file.
;For DOS XL only!
;Compile this and append it to the end
;of SUPKEY.COM.
;SUPKEY is Keith Ledbetter's great
;SuperKEY! macro processor for XL/XEs.
;(But don't bug him with questions
; about this!)
SET $E =$4000
SET $491=$4000
;INCLUDE "D:SYSLIB.ACT"
;GETARGS.ACT
;GetArgs - Pull arguments from CP
; buffer into temporary area and
; return the NUMBER of arguments
; as the function value and the
; ADDRESSES of strings containing
; the arguments in the CARD ARRAY
; argv.
;REMEMBER:
; The first argument (=argv(0)) is
; the name of the extrinsic command!
; The CP buffer is only 60 bytes long,
; so there are 29 args max.
; The default drive spec (in ASCII) is
; stored at (dosvec^ + 7)
BYTE FUNC GetArgs( CARD ARRAY argV BYTE maxArgs )
BYTE nArgs=[0] ; num args encountered
,bufOffset=[0] ; CP buffer offset
,argPtr=[0] ; arg " "
,curArg=[0] ; offset of start of this arg
,argLen=[0] ; length of this arg
,c=[0] ; temp character
BYTE ARRAY argspace( 80 )= ;clear some space
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
;space is CMD(=ARG0) ARG1 ARG2... ARG(MAXARGS)
BYTE POINTER cmdBuf=[0]
CARD dosVec = 10
nArgs = 0
argPtr = 0
bufOffset = $3F
cmdBuf = dosVec
IF maxArgs>29 THEN maxArgs=29 FI
DO ;skip leading spaces
WHILE cmdBuf(bufOffset)=$20
DO bufOffset ==+ 1 OD
;check for end of buf (60 + $3F offset)
IF bufOffset>123 THEN EXIT FI
;save start of this argument
curArg = argPtr
argPtr ==+ 1
argLen = 0
;copy chrs up to whitespc or comma
DO c = cmdBuf( bufOffset )
IF (c=' )
OR (c=$9B)
OR (c=0)
OR (c=',)
THEN EXIT
FI
argspace( argPtr ) = c
bufOffset ==+ 1
argPtr ==+ 1
argLen ==+ 1
OD
;If this arg empty, at end of arg list
IF argLen=0 THEN EXIT FI
;Now add argument to list
argspace( curArg ) = argLen
argV( nArgs ) = argspace+curArg
nArgs ==+ 1
UNTIL nArgs >= maxArgs
OD
RETURN( nArgs )
;-------------------------------------
PROC ChangeDAT(BYTE ARRAY desired,at)
BYTE i
FOR i=1 TO desired^
DO at^=desired(i) at==+1 OD
RETURN
PROC FixAndGo()
CARD ARRAY argaddrs(4)
BYTE POINTER exten
GetArgs(argaddrs,3)
exten=argaddrs(1)
IF exten^=0 ;use .DAT as default
THEN RETURN
FI
IF exten^>3 ;exten too long
THEN exten^=3
FI
ChangeDAT(exten,$53CA) ;file name
ChangeDAT(exten,$5498) ;not-ok msg
RETURN
;---end of SUPERK.ACT-----------------